<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : configurador.xsl
    Created on : March 28, 2012, 10:14 AM
    Author     : rego
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="/">
       
                <form name="pizza" action="configurador?action=addEncomenda" method="POST">
                <h3>Tamanho</h3>
                <select id="tamanho" name="tamanho" onchange="updatePreco()">
                    <option value="pequena">pequena - 1x preço</option>
                    <option value="media">media - 1.75x preco</option>
                    <option value="grande">grande - 2.5x preco</option>
                </select>
                <h3>Massa</h3>
                <select id="massaSelect" name="massaSelect" onchange="updatePreco()">
                    <xsl:for-each select="pizza/massas/massa">
                        <option>
                            <xsl:attribute name="value">
                                <xsl:value-of select="preco"/>,<xsl:value-of select="nome"/>
                            </xsl:attribute>
                            <xsl:value-of select="nome" /> - <xsl:value-of select="preco" /> euros
                            </option>
                        </xsl:for-each>
                </select>
                        <h3>Ingredientes</h3>
                        <xsl:for-each select="pizza/ingredientes/ingrediente">
                            <input type="checkbox">
                            <xsl:attribute name="name">ingredientes</xsl:attribute>
                            <xsl:attribute name="onchange">updatePreco()</xsl:attribute>
                            <xsl:attribute name="value">
                            <xsl:value-of select="preco" />,<xsl:value-of select="nome"/>
                            </xsl:attribute>
                            </input>
                            <xsl:value-of select="nome" /> - <xsl:value-of select="preco" /> euros
                             <br />
                            
                            </xsl:for-each> <br />
                    Morada
                    <input type="text" name="morada" value="" id="morada" /> <br /><br />
                    <input type="submit" value="Registar Encomenda" />
                    <input type="hidden" name="preco" id="preco" value="0" />
                    <h2>Preco Pizza</h2>
                    <h3 id="precoPizza" style="color:black">0 euros</h3>
                    </form>
                  
                </xsl:template>

            </xsl:stylesheet>
